/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rbh.risk.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * @author IT-Mafia
 */
@Entity
@Table(name = "rbh_risk_severity_level")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@XmlRootElement
public class SeverityLevel implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "SEVERITY_LEVEL_ID", unique = true, nullable = false, columnDefinition = "smallint UNSIGNED")
    private Byte severityLevelId;
    @Column(name = "SEVERITY_LEVEL_ABBREVIATION", length = 3)
    private String severityLevelAbbreviation;
    @Basic(optional = false)
    @Column(name = "SEVERITY_LEVEL_NAME", unique = true, nullable = false, length = 100)
    private String severityLevelName;
    @Basic(optional = false)
    @Column(name = "SEVERITY_LEVEL_ORDER_NUMBER", columnDefinition = "tinyint UNSIGNED default 0", nullable = false)
    private short severityLevelOrderNumber;
    @Basic(optional = false)
    @Column(name = "SEVERITY_LEVEL_STATUS", columnDefinition = "boolean default true", nullable = false)
    private boolean severityLevelStatus;
    @OneToMany(mappedBy = "severityLevel", fetch = FetchType.LAZY)
    @Cascade({CascadeType.DETACH})
    private List<SeverityLevelDetail> severityLevelDetailList;

    public SeverityLevel() {
    }

    public SeverityLevel(Byte severityLevelId) {
        this.severityLevelId = severityLevelId;
    }

    public SeverityLevel(Byte severityLevelId, String severityLevelName, short severityLevelOrderNumber, boolean severityLevelStatus) {
        this.severityLevelId = severityLevelId;
        this.severityLevelName = severityLevelName;
        this.severityLevelOrderNumber = severityLevelOrderNumber;
        this.severityLevelStatus = severityLevelStatus;
    }

    public Byte getSeverityLevelId() {
        return severityLevelId;
    }

    public void setSeverityLevelId(Byte severityLevelId) {
        this.severityLevelId = severityLevelId;
    }

    public String getSeverityLevelAbbreviation() {
        return severityLevelAbbreviation;
    }

    public void setSeverityLevelAbbreviation(String severityLevelAbbreviation) {
        this.severityLevelAbbreviation = severityLevelAbbreviation;
    }

    public String getSeverityLevelName() {
        return severityLevelName;
    }

    public void setSeverityLevelName(String severityLevelName) {
        this.severityLevelName = severityLevelName;
    }

    public short getSeverityLevelOrderNumber() {
        return severityLevelOrderNumber;
    }

    public void setSeverityLevelOrderNumber(short severityLevelOrderNumber) {
        this.severityLevelOrderNumber = severityLevelOrderNumber;
    }

    public boolean getSeverityLevelStatus() {
        return severityLevelStatus;
    }

    public void setSeverityLevelStatus(boolean severityLevelStatus) {
        this.severityLevelStatus = severityLevelStatus;
    }

    public List<SeverityLevelDetail> getSeverityLevelDetailList() {
        return severityLevelDetailList;
    }

    public void setSeverityLevelDetailList(List<SeverityLevelDetail> severityLevelDetailList) {
        this.severityLevelDetailList = severityLevelDetailList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (severityLevelId != null ? severityLevelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SeverityLevel)) {
            return false;
        }
        SeverityLevel other = (SeverityLevel) object;
        if ((this.severityLevelId == null && other.severityLevelId != null) || (this.severityLevelId != null && !this.severityLevelId.equals(other.severityLevelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rbh.risk.entity.SeverityLevel[ severityLevelId=" + severityLevelId + " ]";
    }
}
